<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../Public/css/index.css" />
<link rel="stylesheet" type="text/css" href="../Public/css/reg.css" />
<title>会员注册_天生嫁对婚恋</title>
<script type="text/javascript" src="../Public/scripts/swfobject_modified.js" ></script>
<script type="text/javascript" src="../Public/scripts/common.js" ></script>
<script type="text/javascript" src="../Public/scripts/function.js" ></script>
<script type="text/javascript" src="../Public/ajax/Base.js" ></script>
<script type="text/javascript" src="../Public/ajax/prototype.js" ></script>
<script type="text/javascript" src="../Public/ajax/mootools.js" ></script>
<script type="text/javascript" src="../Public/ajax/Ajax/ThinkAjax.js" ></script>
<script type="text/javascript">
var flag = 1;
//重载验证码  
function freshVerify() {  
  document.getElementById('verifyImg').src='__URL__/verifyImage/'+Math.random();  
  $('verify').value='';
  $('verify_code_result').innerHTML = '';
}  
function IsUsed(data,status) {
	switch(status) {
	case 1:
		$('username_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" /><span style="font-size:12px;color:green"> 恭喜您，用户名可用</span>';
		break;
	case 2:
		$('user_email_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		break;
	case 3:
		$('user_mobile_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		break;
	case 4:
		$('verify_code_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		break;
	case 5:
		$('username_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 该用户名已经被注册！</span>';
		break;
	case 6:
		$('user_email_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 该邮箱已经被注册！</span>';
		break;
	case 7:
		$('user_mobile_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 该手机号码已经被注册！</span>';
		break;
	case 8:
		$('verify_code_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 验证码错误！</span>';
		break;
	case 10:
		alert('注册成功！');
		window.location = '__URL__/index';
		break;
	}
}
function CheckUsername(value) {
	var reg = /^([a-z]|[A-Z])\w{2,19}$/;
	if(value=="")
		$('username_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 用户名不能为空！</span>';
	else if(value.length<3||value.length>20)
		$('username_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 用户名长度过短或过长！</span>';
	else if(!reg.test(value)) 
		$('username_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 非法字符或首字符不是字母！</span>';
	else 
		ThinkAjax.send('checkName','ajax=1&username='+$('username').value,IsUsed,'username_result');
}
function CheckMail(value) {
	var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	if(value=="") 
		$('user_email_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 邮箱不能为空！</span>';
	else if(!reg.test(value)) 
		$('user_email_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 邮箱格式不正确！</span>';
	else
		ThinkAjax.send('checkEmail','ajax=1&user_email='+$('user_email').value,IsUsed,'user_email_result');
}
function CheckUserPwd(value) {
	if(value=="") {
		$('user_password_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 密码不能为空！</span>';
		return false;
	}
	else if(value.length<6||value.length>20) {
		$('user_password_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 密码长度过短或过长！</span>';
		return false;
	}
	else {
		$('user_password_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		return true;
	}
}
function CheckRetypePwd(value) {
	if(value=="") {
		$('user_password_confirm_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 密码不能为空！</span>';
		return false;
	}
	else if(value!=$('user_password').value) {
		$('user_password_confirm_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 两次输入密码不一致！</span>';
		return false;
	}
	else {
		$('user_password_confirm_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		return true;
	}
}
function CheckVerifyCode(value) {
	if(value=="")
		$('verify_code_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 验证码不能为空！</span>';
	else
		ThinkAjax.send('checkCode','ajax=1&code='+$('verify').value,IsUsed,'verify_code_result');
}
function CheckNickName(value) {
	if(value=="") {
		$('user_nickname_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 会员昵称不能为空！</span>';
		return false;
	}
	else if(value.length<2||value.length>20) {
		$('user_nickname_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 会员昵称长度在2-20范围内！</span>';
		return false;
	}
	else {
		$('user_nickname_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		return true;
	}
}
function CheckTrueName(value) {
	if(value=="") {
		$('user_truename_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 真实姓名不能为空！</span>';
		return false;
	}
	else if(value.length<2||value.length>20) {
		$('user_truename_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 真实姓名长度在2-20范围内！</span>';
		return false;
	}
	else {
		$('user_truename_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		return true;
	}
}
function CheckSex(value) {
	if(value=="") {
		$('user_sex_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 性别不能为空！</span>';
		return false;
	}
	else {
		$('user_sex_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		return true;
	}
}
function CheckBirthday(value) {
	if(value=="") {
		$('user_birthday_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 出生日期不能为空！</span>';
		return false;
	}
	else {
		$('user_birthday_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		return true;
	}
}
function CheckPlace(value) {
	if(value=="") {
		$('user_place_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 常驻地不能为空！</span>';
		return false;
	}
	else {
		$('user_place_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		return true;
	}
}
function CheckMarriage(value) {
	if(value=="") {
		$('user_marriage_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 婚姻状况不能为空！</span>';
		return false;
	}
	else {
		$('user_marriage_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		return true;
	}
}
function CheckIncome(value) {
	if(value=="") {
		$('user_income_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 月收入不能为空！</span>';
		return false;
	}
	else {
		$('user_income_result').innerHTML = '<img src="../Public/images/regCorrect.png" width="15px" height="15px" />';
		return true;
	}
}
function CheckMobile(value) {
	var reg = /^((13[0-9])|(15[0-9])|180|(18[5-9]))[0-9]{8}$/;
	if(value=="")
		$('user_mobile_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 手机号码不能为空！</span>';
	else if(!reg.test(value)) 
		$('user_mobile_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 手机号码格式不正确！</span>';
	else
		ThinkAjax.send('checkMobile','ajax=1&user_mobile='+$('user_mobile').value,IsUsed,'user_mobile_result');
}
function regCheck() {
	var flag=1;
	//if(CheckUsername($('username').value)==false) flag=0;
	//if(CheckMail($('user_email').value)==false) flag=0;
	var regName = /^([a-z]|[A-Z])\w{2,19}$/;
	if($('username').value=="") {
		$('username_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 用户名不能为空！</span>';
		flag=0;
	}
	else if($('username').value.length<3||$('username').value.length>20) {
		$('username_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 用户名长度过短或过长！</span>';
		flag=0;
	}
	else if(!regName.test($('username').value)) {
		$('username_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 非法字符或首字符不是字母！</span>';
		flag=0;
	}
	var regMail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	if($('user_email').value=="") {
		$('user_email_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 邮箱不能为空！</span>';
		flag=0;
	}
	else if(!regMail.test($('user_email').value)) {
		$('user_email_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 邮箱格式不正确！</span>';
		flag=0;
	}
	if($('verify').value=="") {
		$('verify_code_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 验证码不能为空！</span>';
		flag=0;
	}	
	var regMobile = /^((13[0-9])|(15[0-9])|180|(18[5-9]))[0-9]{8}$/;
	if($('user_mobile').value=="") {
		$('user_mobile_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 手机号码不能为空！</span>';
		flag=0;
	}
	else if(!regMobile.test($('user_mobile').value)) {
		$('user_mobile_result').innerHTML = '<img src="../Public/images/regError.png" width="15px" height="15px" /><span style="font-size:12px;color:red"> 手机号码格式不正确！</span>';
		flag=0;
	}
	//if(flag==1)
	//	ThinkAjax.send('checkAll','ajax=1&username='+$('username').value+'&user_email='+$('user_email').value+'&user_mobile='+$('user_mobile').value+'&code='+$('verify').value,IsUsed,'');
	//alert(flag);
	if(CheckUserPwd($('user_password').value)==false) flag=0;
	if(CheckRetypePwd($('user_password_confirm').value)==false) flag=0;
	//if(CheckVerifyCode($('verify').value)==false) flag=0;
	if(CheckNickName($('user_nickname').value)==false) flag=0;
	if(CheckTrueName($('user_truename').value)==false) flag=0;
	if(CheckSex($('user_sex').value)==false) flag=0;
	if(CheckBirthday($('user_birthday').value)==false) flag=0;
	if(CheckPlace($('user_province').value)==false) flag=0;
	if(CheckMarriage($('user_marriage').value)==false) flag=0;
	if(CheckIncome($('user_income').value)==false) flag=0;
	//if(CheckMobile($('user_mobile').value)==false) flag=0;
	if($('reg').checked==false) {
		alert('请接受注册条款！');
		return false;
	}
	if(flag==1)
		return true;
	else 
		return false;
}
function register() {
	if(regCheck()!=false) {
		ThinkAjax.sendForm('reg_form', 'reg', IsUsed, '');
	}
}
</script>
</head>

<body onload="freshVerify()">
<!--顶部登入栏开始-->
<include file="Index:header" />
<!--顶部登入栏结束-->
<div class="bodyContent">
<!--中间内容部分开始-->
<div class="bodyBar">
	<include file="Index:navi" />
    <!--当中silver部分-->
    <div class="bodyMiddleSilverBar">
        <include file="Index:leftSidebarFirst" />
        <!--swf活动-->
        <div class="bodyMiddleSwf">
        <div class="regBody">
        	<div class="regLeft">
            </div>
            <div class="regRight">
            <form id="reg_form" method="post">
            	<div style="margin-left:5px; margin-right:5px; margin-top:10px; padding-bottom:5px; border-bottom-style:groove; border-bottom-width:thin;">
            		<span style="font-size:16px; font-weight:bold; margin-left:10px; margin-top:5px;">会员注册</span>
                	<span style="font-size:12px; padding-left:50px;">以下标有(<span style="color:#FF0000;">**</span>)项注册后不可更改，标有(<span style="color:#FF0000;">*</span>)项必须输入。</span>
            	</div>
                <div class="regLine">
                	<div class="regListTitle">
                    	用户名：
                    </div>
                    <div class="regListForm">
                    	<input name="username" type="text" size="20" maxlength="50" onblur="CheckUsername(this.value)" id="username" /><span style="color:#F00">**</span>
                    </div>
                    <div id="username_result" class="regListResult">
                    	 [合法字符为字母或数字或"_",首字符须是字母,长度为3-20个字符]
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	电子邮箱：
                    </div>
                    <div class="regListForm">
                    	<input name="user_email" type="text" size="20" maxlength="50" onblur="CheckMail(this.value)" value="" id="user_email" /><span style="color:#F00">**</span>
                    </div>
                    <div id="user_email_result" class="regListResult">
                    	 [请您使用常用电子邮箱]
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	登录密码：
                    </div>
                    <div class="regListForm">
                    	<input type="password" name="user_password" size="20" maxlength="20" onblur="CheckUserPwd(this.value)" value="" id="user_password" /><span style="color:#F00">*</span>
                    </div>
                    <div id="user_password_result" class="regListResult">
                    	 [密码长度为6-20位]
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	确认密码：
                    </div>
                    <div class="regListForm">
                    	<input type="password" name="user_password_confirm" size="20" maxlength="20" onblur="CheckRetypePwd(this.value)" value="" id="user_password_confirm" /><span style="color:#F00">*</span>
                    </div>
                    <div id="user_password_confirm_result" class="regListResult">
                    	 [重新输入相同密码，若含有字母请注意大小写]
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	验证码：
                    </div>
                    <div class="regListForm">
                    	<input type='text' name="verify" id="verify" maxlength="4" onblur="CheckVerifyCode(this.value)" style ="width:60px"/><span style="color:#F00">*</span>
                     	<img style='cursor:pointer' title='刷新验证码' src='verifyImage' id='verifyImg' onclick='freshVerify()'/>  
                    </div>
                    <div id="verify_code_result" class="regListResult">
                    	 
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	会员昵称：
                    </div>
                    <div class="regListForm">
                    	<input name="user_nickname" type="text" size="20" maxlength="20" onblur="CheckNickName(this.value)" id="user_nickname" /><span style="color:#F00">*</span>
                    </div>
                    <div id="user_nickname_result" class="regListResult">
                    	 [公开信息，不要包含真实姓名及联系方式]
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	真实姓名：
                    </div>
                    <div class="regListForm">
                    	<input name="user_truename" type="text" size="20" maxlength="20" onblur="CheckTrueName(this.value)" value="" id="user_truename" /><span style="color:#F00">*</span>
                    </div>
                    <div id="user_truename_result" class="regListResult">
                    	 [该项资料不公开]
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	性别：
                    </div>
                    <div class="regListForm" style="width:90px">
                    	<select name="user_sex" onchange="CheckSex(this.value)" id="user_sex">
							<option value="">请选择</option>
							<option value="男士">男</option>
							<option value="女士">女</option>
						</select><span style="color:#F00">*</span>
                    </div>
                    <div id="user_sex_result" class="regListResult">
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	出生日期：
                    </div>
                    <div class="regListForm">
                    	<input type="text" name="user_birthday" style="width:150px" value="点击选择生日" onclick="HS_setDate(this)" onblur="CheckBirthday(this.value)" id="user_birthday"/><span style="color:#F00">**</span>
                    </div>
                    <div id="user_birthday_result" class="regListResult">
                    	
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	常驻地：
                    </div>
                    <div class="regListForm">
                    	<select onchange="setcity('user_province','user_city','{$user['user_city']}');CheckPlace(this.value);" name="user_province" id="user_province">
							<option value=''>--所在省份--</option>
							<volist name="provincelist" id="province">
							<option value='{$province.opt_value}'>{$province.opt_name}</option>
							</volist>
						</select> 
						<select name="user_city" id="user_city">
						<option value=''>请选择</option>
						</select><span style="color:#F00">**</span>
                    </div>
                    <div id="user_place_result" class="regListResult">
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	婚姻状况：
                    </div>
                    <div class="regListForm" style="width:90px">
                    	<select name="user_marriage" onchange="CheckMarriage(this.value)" id="user_marriage">
						<option value="">请选择</option>
						<option value='未婚'>未婚</option>
						<option value='短婚'>短婚</option>
						<option value='离异'>离异</option>
						<option value='丧偶'>丧偶</option>
						</select><span style="color:#F00">*</span>
                    </div>
                    <div id="user_marriage_result" class="regListResult">
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	月收入：
                    </div>
                    <div class="regListForm" style="width:180px">
                    	<select name="user_income" onchange="CheckIncome(this.value)" id="user_income">
						<option value="">请选择</option>
						<option value='2000元及以下'>2000元及以下</option>
						<option value='2001-5000元'>2001-5000元</option>
						<option value='5001-8000元'>5001-8000元</option>
						<option value='8001-10000元'>8001-10000元</option>
						<option value='10001-20000元'>10001-20000元</option>
						<option value='20001-50000元'>20001-50000元</option>
						<option value='50000元以上'>50000元以上</option>
						</select><span style="color:#F00">**</span>
                    </div>
                    <div id="user_income_result" class="regListResult">
                    </div>
                </div>
                
                <div class="regLine">
                	<div class="regListTitle">
                    	手机号码：
                    </div>
                    <div class="regListForm">
                    	<input name="user_mobile" type="text" size="20" maxlength="40" onblur="CheckMobile(this.value)" value="" id="user_mobile" /><span style="color:#F00">*</span>
                    </div>
                    <div id="user_mobile_result" class="regListResult">
                    	  [该项资料不公开]
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListTitle">
                    	QQ：
                    </div>
                    <div class="regListForm">
                    	<input name="user_qq" type="text" size="20" maxlength="15" id="user_qq" /><span style="color:#F00"></span>
                    </div>
                    <div class="regListResult">
                    	  [该项资料不公开]
                    </div>
                </div>
                <div class="regLine">
                	<div class="regListForm" style="padding-top:5px;">
                    	<input type="checkbox" name="reg" value="复选框" id="reg" />
                    </div>
                    <div style="font-size:12px; float:left; margin-top:7px;">同意  <a href=""><span>天生嫁对注册条款</span></a></div>
                    <div class="regListForm">
                    	<input type="button" onclick="register();" name="sub" value="注  册" id="sub" />
                    </div>
                </div>
            </form>
            </div>
        </div>
        </div>
        <div class="bodyMiddleRight" style="background-image:url(../Public/images/RightBg.png);">
        	<include file="Index:rightSidebarFirst" />
    	</div>
    </div>
    <!--底下silver部分-->
    <div class="bodyBottomSilverBar">
    	<div class="SilverBarAd">
       		<div style="float:left; width:200px; height: 100px;">
            </div>
            <div style="float:left; width:200px; height: 100px;">
            </div>
        </div>
    </div>
    <!--底下分栏部分-->
    <!--底下微博刷新部分-->
    <!--底下装饰-->
    <img src="../Public/images/alpha_city.png" align="bottom"/>
</div>
<!--中间内容部分结束-->
</div>
<!--底部栏开始-->
<include file="Index:bottom" />
<!--底部栏结束-->

<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>
</body>
</html>
